package at.spengergasse.model;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

public class RechnungTest {
	
	private static final String email = "leo@aon.at";
	private static final String anrede = "Herr";
	private static final String name = "Hugo";
	private static final String passwort = "123456";
	private static final String strasse = "Spengergasse 20";
	
	private Rechnung r = new Rechnung();

	Kunden k = new Kunden(email, anrede, name, passwort, strasse);
	Kunden j = null;
	
	@Test
	public void testInstanceStd(){
		new Rechnung();
		}
	
	@Test
	public void testDateCorrect(){
		new Rechnung("2010-05-21");
	}

	
	@Test(expected = IllegalArgumentException.class)
	public void testDateIncorrect(){
		new Rechnung("10000-0000-0");
	}
	
	@Test(expected = IllegalArgumentException.class)
	public void testDateInvalid(){
		new Rechnung("2010-10-35");
	}
	
	@Test(expected = IllegalArgumentException.class)
	public void testDateInvalid2(){
		new Rechnung("2010-13-05");
	}
	
	@Test
	public void testInstanceDateKundenID(){
		new Rechnung("2010-05-22", (long)9999);
	}
	
	@Test
	public void testSetKunde(){
		r.setKunde(k);
	}
	
	@Test(expected = IllegalArgumentException.class)
	public void testSetKundeNull(){
		r.setKunde(j);
	}
	
	@Test
	public void testGetKunde(){
		r.getKunde();
	}
	
	@Test
	public void testSetGetKundenID(){
		r.setKundenID(Long.valueOf(9999));
		System.out.println(r.getKundenID());
		Long ID = r.getKundenID();
		assertEquals(ID, r.getKundenID());
	}
}